<!DOCTYPE html>
<!-- saved from url=(0056)http://startbootstrap.com/templates/simple-sidebar.html# -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<title>Panel</title>
<script src="<?php echo base_url();?>js/chart.js"></script>
<?php $this->load->view('panel_head');?>
</head>

<body onload="startTime()">
<div style="background-color:#333; height:46px; width:100%; position:fixed; z-index:10000;">
  <?php $this->load->view('panel_header');?>
</div>
<div style="height:46px;"></div>
<div id="wrapper"> 
  
  <!-- Sidebar -->
  <div id="sidebar-wrapper">
    <?php $this->load->view('panel_sidebar');?>
  </div>
  
  <!-- Page content -->
  <div id="page-content-wrapper">
    <div class="content-header">
      <h1><span class="glyphicon glyphicon-th-large"></span>&nbsp;Dashboard</h1>
    </div>
    <!-- Keep all page content within the page-content inset div! -->
    
    <div class="page-content inset"> 
    <div class="panel panel-default">
        <div class="panel-body">
          <div class="row">
          
            <div class="col-md-6">
              <table>
                <tr>
                  <td width="130">Web Service</td>
                  <td width="20">:</td>
                  <td><?php echo @$service[0]['web_name'];?></td>
                </tr>
                <tr>
                  <td>Website Address</td>
                  <td>:</td>
                  <td><a href=<?php echo base_url();?>><?php echo base_url();?></a></td>
                </tr>
                <tr valign="top">
                  <td width="130">Logo</td>
                  <td width="20">:</td>
                  <td height="60" >
                  <?php if(@$service[0]['web_logo'] != '') { ?>
                  <img src="<?php echo base_url();?>img/<?php echo @$service[0]['web_logo'];?>" width="100em"/>
                  <?php } ?>
                  </td>
                </tr>
              </table>
              </br>
            </div>
          
          </div>
          <!-- <div class="row"> --> 
          
        </div>
        <!-- <div class="panel-body"> --> 
        
      </div>
    
    
    
  
      
      
    
   
    <!-- <div class="panel panel-default"> -->
      <?php $i=0; ?>
      <?php foreach($setting as $setting) { ?>
      <div class="panel panel-default">
        <div class="panel-body">
          <div class="row">
            <div class="col-md-6">
              <table>
                <tr>
                  <td rowspan="2" width="70em" style="padding-top:10px"><?php 
				  if($connection[$i] == 'Connected'){
					  print '<font color="#5cb85c" size="+6"><span class="glyphicon glyphicon-hdd"></span></font>';
				  }else{
					  print '<font color="d9534f" size="+6"><span class="glyphicon glyphicon-remove"></span></font>';
				  }
				  ?></td>
                  <td><?php echo @$setting['server_name']?></td>
                </tr>
                <tr>
                  <td><?php echo @$setting['server_ip']?></td>
                </tr>
              </table>
            </div>
            <!-- <div class="col-md-6"> -->
            
            <div class="col-md-6">
              <table>
                <tr>
                  <td width="130em">Vdo Files</td>
                  <td width="20em">:</td>
                  <td><?php 
					$this->db->where('server_id',$setting['server_id']); 
					echo $this->db->count_all_results('vdo')
				   ?> files</td>
                </tr>
                <tr>
                  <td>File Size</td>
                  <td>:</td>
                  <td>
                  <?php
				  	$this->db->where('server_id',$setting['server_id']); 
					$this->db->select_sum('vdo_size');
					$query = $this->db->get('vdo');
					$size = $query->result_array();					
					$bytes =  $size[0]['vdo_size'];
					
					$CI =& get_instance();
					$CI->load->library('calculate_byte');
					$vdofile_server = $CI->calculate_byte->index($bytes);
					
					printf ('%.2f ', $vdofile_server[0]);
                    echo $vdofile_server[1];
				  ?>
                  </td>
                </tr>
              </table>
            </div>
            <!-- <div class="col-md-6"> --> 
            
          </div>
          <!-- <div class="row"> --> 
        </div>
        <!-- <div class="panel-body"> --> 
        
      </div>
      <?php $i++;}?>
      <!-- <div class="panel-default"> -->
      
      
      <!-- <div class="panel-default"> -->
      
      <div class="panel panel-default">
        <div class="panel-body">
          <div class="row">
            <div class="col-md-6">
              <table>
                <thead>
                  <tr>
                    <td colspan="3"><h4><strong>Summarization</strong></h4></td>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td width="130em">Streaming</td>
                    <td width="20em">:</td>
                    <td><?php echo $count ?> servers</td>
                  </tr>
                  <tr>
                    <td>Online</td>
                    <td>:</td>
                    <td><?php echo $connection['online'];?></td>
                  </tr>
                  <tr>
                    <td>Offline</td>
                    <td>:</td>
                    <td><?php echo $connection['offline'];?></td>
                  </tr>
                  <tr>
                    <td>Vdo Files</td>
                    <td>:</td>
                    <td><?php echo $this->db->count_all_results('vdo'); ?> files</td>
                  </tr>
                  <tr>
                    <td>File Size</td>
                    <td>:</td>
                    <td>
					 <?php printf ('%.2f', $sum_vdofile[0]); ?>
                     <?php echo $sum_vdofile[1];?></td>
                  </tr>
                </tbody>
              </table>
            </div>
            <div class="col-md-6"> </div>
          </div>
          <!-- <div class="row"> --> 
        </div>
        <!-- <div class="panel-body"> --> 
        
      </div>
      <!-- <div class="panel-default"> -->
      
      
      <div class="row">
      
      
      <div class="col-md-4">
      <table class="table table-striped">          
          <tr class="info" align="center">
            <td width="5%"><strong>No</strong></td>
            <td width="87%" align="left"><strong>Video</strong></td>
            <td width="8%"><strong>Views</strong></td>
          </tr>
          <?php $j = 0 ;?>
          <?php foreach($top_view as $top_view) { ?>
          <tr>
            <td><?php echo $j+1; ?></td>
            <td><a href="<?php echo base_url();?>index.php/pvdo/profile/<?php echo $top_view['vdo_id'];?>"><?php echo $top_view['vdo_name'];?></a></td>
            <td align="right"><?php echo $top_view['vdo_view'];?></td>
          </tr> 
          <?php $j++; } ?>
        </table>
        </div>
      
      
      <div class="col-md-4">
        <table class="table table-striped">          
          <tr class="success" align="center">
            <td width="5%"><strong>No</strong></td>
            <td width="87%" align="left"><strong>Video</strong></td>
            <td width="8%"><strong>Likes</strong></td>
          </tr>
          <?php $k = 0 ;?>
          <?php foreach($top_like as $top_like) { ?>
          <tr>
            <td><?php echo $k+1; ?></td>
            <td><a href="<?php echo base_url();?>index.php/pvdo/profile/<?php echo $top_like['vdo_id'];?>"><?php echo $top_like['vdo_name'];?></a></td>
            <td align="right"><?php echo $top_like['like_rate'];?></td>
          </tr> 
          <?php $k++; } ?>
        </table>
      </div>
      
      
       <div class="col-md-4">
        <table class="table table-striped">          
          <tr class="danger" align="center">
            <td width="5%"><strong>No</strong></td>
            <td width="87%" align="left"><strong>Video</strong></td>
            <td width="8%"><strong>Disikes</strong></td>
          </tr>
          <?php $l = 0 ;?>
          <?php foreach($top_dislike as $top_dislike) { ?>
          <tr>
            <td><?php echo $l+1; ?></td>
            <td><a href="<?php echo base_url();?>index.php/pvdo/profile/<?php echo $top_dislike['vdo_id'];?>"><?php echo $top_dislike['vdo_name'];?></a></td>
            <td align="right"><?php echo $top_dislike['dislike_rate'];?></td>
          </tr> 
          <?php $l++; } ?>
        </table>
      </div>
      
      
      </div>
      
      
  
      
    </div>
    <!-- <div class="page-content inset"> --> 
    
  </div>
  <!--  <div id="page-content-wrapper"> --> 
  
</div>
<!-- <div id="wrapper"> --> 



<!-- Custom JavaScript for the Menu Toggle --> 
<script>
    $("#menu-toggle").click(function(e) {
        e.preventDefault();
        $("#wrapper").toggleClass("active");
    });
</script> 


</body>
</html>